﻿# coding: utf-8

import wx
import wx.lib.filebrowsebutton as filebrowse

class wxDialogLogicGridCreate(wx.Dialog):
	def __init__(self, parent):
		wx.Dialog.__init__(self, parent, title = TD.TERRAIN_CREATE)

		sizerWidth = self.__CreateUIWidth()
		sizerHeight = self.__CreateUIHeight()
		sizerGridSize = self.__CreateUIGridSize()
		sizerOkCancel = self.__CreateUIOkCancel()
		
		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(sizerWidth, 0, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, border = 10)
		sizer.Add(sizerHeight, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, border = 10)
		sizer.Add(sizerGridSize, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, border = 10)
		sizer.Add(sizerOkCancel, 0, wx.CENTER, border = 15)
		self.SetSizer(sizer)
		self.Fit()

	def __CreateUIWidth(self):
		staticWidth = wx.StaticText(self, wx.NewId(), TD.LOGIC_GRID_WIDTH)
		self._editWidth = wx.TextCtrl(self, wx.NewId())
		sizerWidth = wx.BoxSizer(wx.HORIZONTAL)
		sizerWidth.Add(staticWidth, 0, wx.CENTER, border = 10)
		sizerWidth.Add(self._editWidth, 1, wx.ALL|wx.EXPAND, border = 5)
		return sizerWidth
		
	def __CreateUIHeight(self):
		staticHeight = wx.StaticText(self, wx.NewId(), TD.LOGIC_GRID_HEIGHT)
		self._editHeight = wx.TextCtrl(self, wx.NewId())
		sizerHeight = wx.BoxSizer(wx.HORIZONTAL)
		sizerHeight.Add(staticHeight, 0, wx.CENTER, border = 10)
		sizerHeight.Add(self._editHeight, 1, wx.ALL|wx.EXPAND, border = 5)
		return sizerHeight
										
	def __CreateUIGridSize(self):
		staticGridSize = wx.StaticText(self, wx.NewId(), TD.LOGIC_GRID_SIZE)
		self._editGridSize = wx.TextCtrl(self, wx.NewId())
		sizerGridSize = wx.BoxSizer(wx.HORIZONTAL)
		sizerGridSize.Add(staticGridSize, 0, wx.CENTER, border = 10)
		sizerGridSize.Add(self._editGridSize, 1, wx.ALL|wx.EXPAND, border = 5)
		return sizerGridSize
														
	def __CreateUIOkCancel(self):
		bnTerrainCreateOk = wx.Button(self, wx.ID_OK, TD.BUTTON_OK)
		bnTerrainCreateCancel = wx.Button(self, wx.ID_CANCEL, TD.BUTTON_CANCEL)
		sizerOkCancel = wx.BoxSizer(wx.HORIZONTAL)
		sizerOkCancel.Add(bnTerrainCreateOk, 0, wx.ALL, border = 15)
		sizerOkCancel.Add(bnTerrainCreateCancel, 0, wx.ALL, border = 15)
		return sizerOkCancel
		
	def GetWidth(self):
		return int(self._editWidth.GetValue())
			
	def GetHeight(self):
		return int(self._editHeight.GetValue())

	def GetGridSize(self):
		return int(self._editGridSize.GetValue())
		